<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/flexible.js"></script>
    <script src="../js/echarts.min.js"></script>
    <style>
        .box {
            width: 7.5rem;
            height: 5rem;
        }
    </style>
</head>

<body>
    <div class="box" id='box'></div>
    <script>
        const MyEcharts = echarts.init(document.getElementById('box'))
        const option = {
            xAxis: {
                scale: true, //不从0开始 从最小开始
            },
            yAxis: {
                scale: true //不从0开始 从最小开始
            },
            series: [{
                // symbolSize: 20, //散点的大小
                symbolSize: function (arg) {
                    //动态实现不同点不同大小
                    let a = arg[0]
                    let b = arg[1]
                    let bm = a / (b + b) //自定义规则
                    if (bm > 1) {
                        return 10
                    }
                    return 20
                },
                itemStyle: { //设置散点样式
                    // color: 'yellow'
                    //动态实现颜色
                    color: function (arg) {
                        let a = arg.data[0]
                        let b = arg.data[1]
                        let bm = a / (b + b) //自定义规则
                        if (bm > 1) {
                            return 'yellow'
                        }
                        return 'pink'
                    }
                },
                data: [
                    [50, 8.04],
                    [8.07, 6.95],
                    [13.0, 7.58],
                    [9.05, 8.81],
                    [11.0, 8.33],
                    [14.0, 7.66],
                    [13.4, 6.81],
                    [10.0, 6.33],
                    [14.0, 8.96],
                    [12.5, 6.82],
                    [9.15, 7.2],
                    [11.5, 7.2],
                    [3.03, 4.23],
                    [12.2, 7.83],
                    [2.02, 4.47],
                    [1.05, 3.33],
                    [4.05, 4.96],
                    [6.03, 7.24],
                    [12.0, 6.26],
                    [12.0, 8.84],
                    [7.08, 5.82],
                    [5.02, 5.68]
                ],
                // type: 'scatter' //散点图
                type: 'effectScatter', //涟漪动画
                rippleEffect: { //涟漪动画大小
                    scale: 10
                },
                showEffectOn: 'emphasis' //设置动画触发时间

            }]
        };
        MyEcharts.setOption(option)
    </script>

</body>

</html>

</html>